#include"StdAfx.h"
#include"UISet.h"

void UISet::Do()
{
	switch (action)
	{
	case UISet::SET_ENABLED: {
		CControlUI* ui = m_pm->FindControl(strName);
		//bool* b = (bool*)val;
		ui->SetEnabled(val);
		break;
	}
	case UISet::SET_TEXT: {
		CControlUI* ui = m_pm->FindControl(strName);

		TString* TXT = (TString*)val;

		ui->SetText(TXT->c_str());
		delete TXT;
		break;
	}
	case UISet::SET_VALUE: {
		CProgressUI* ui =dynamic_cast<CProgressUI*>( m_pm->FindControl(strName));
		float* vaf = (float* )val;

		ui->SetValue(*vaf);
		delete vaf;
		break;
	}
	default:
		break;
	}
	//	delete[]strName;
}

UISet::UISet(HWND hwnd, int _action, CDuiString _strName, void* _val) :UIagent(hwnd)
{
	strName = _strName;
	val = _val;
	action = _action;
}

UISet::~UISet()
{
}